
using System.Globalization;

using Avalonia.Data.Converters;
using Avalonia.Media;

using Bee.Base.Models.Controls;

namespace Bee.Base.Converters;

public class ToastrIconConverter : IValueConverter
{
    public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        if (value is ToastrType toastrType)
        {
            return toastrType switch
            {
                ToastrType.Success => StreamGeometry.Parse("M512 21.333333C782.976 21.333333 1002.666667 241.024 1002.666667 512S782.976 1002.666667 512 1002.666667 21.333333 782.976 21.333333 512 241.024 21.333333 512 21.333333z m211.925333 337.408a35.029333 35.029333 0 0 0-49.536 0l-222.805333 222.72-90.026667-90.026666a35.072 35.072 0 1 0-49.578666 49.621333l111.530666 111.573333a35.413333 35.413333 0 0 0 11.605334 9.770667 35.029333 35.029333 0 0 0 47.573333-12.8l241.237333-241.322667a35.029333 35.029333 0 0 0 0-49.578666z"),
                _ => StreamGeometry.Parse("M512 128a384 384 0 1 1-0.042667 768.042667A384 384 0 0 1 512 128z m-19.2 553.258667l76.501333-248.362667-16-1.408-91.52 11.690667-4.693333 13.994666c3.754667 0.085333 6.954667 0.256 9.6 0.512a17.066667 17.066667 0 0 1 13.226667 7.253334c2.986667 4.266667 4.266667 9.088 3.84 14.293333-0.725333 8.277333-3.584 20.48-8.533334 36.565333l-51.754666 166.954667c-4.181333 13.312-6.656 24.277333-7.424 33.109333-1.152 13.226667 1.28 24.533333 7.338666 33.792a33.28 33.28 0 0 0 26.282667 15.402667c30.08 2.645333 61.098667-26.112 93.269333-86.229333l-8.362666-7.936c-13.141333 22.016-24.106667 37.077333-32.853334 45.184-3.285333 3.328-6.4 4.864-9.429333 4.565333-1.834667-0.128-3.413333-1.365333-4.778667-3.797333a12.714667 12.714667 0 0 1-1.706666-7.509334c0.384-4.437333 2.688-13.866667 6.954666-28.074666zM554.496 384a41.301333 41.301333 0 0 0 30.293333-12.458667A41.301333 41.301333 0 0 0 597.333333 341.333333a41.429333 41.429333 0 0 0-12.373333-30.208 41.344 41.344 0 0 0-30.421333-12.458666 40.96 40.96 0 0 0-30.165334 12.458666A41.429333 41.429333 0 0 0 512 341.333333c0 11.776 4.138667 21.845333 12.501333 30.208 8.405333 8.277333 18.346667 12.458667 30.037334 12.458667z")
            };
        }
        return null;
    }

    public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
    {
        return null;
    }
}